/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ar.edu.utn.frsf.cidisi.upcolbpip.b2bcollaborations.impl;

import ar.edu.utn.frsf.cidisi.upcolbpip.b2bcollaborations.B2bcollaborationsPackage;
import ar.edu.utn.frsf.cidisi.upcolbpip.b2bcollaborations.PublicBusinessInterface;

import ar.edu.utn.frsf.cidisi.upcolbpip.businessinterfaces.BusinessInterface;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Public Business Interface</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ar.edu.utn.frsf.cidisi.upcolbpip.b2bcollaborations.impl.PublicBusinessInterfaceImpl#getName <em>Name</em>}</li>
 *   <li>{@link ar.edu.utn.frsf.cidisi.upcolbpip.b2bcollaborations.impl.PublicBusinessInterfaceImpl#getRequiredInterface <em>Required Interface</em>}</li>
 *   <li>{@link ar.edu.utn.frsf.cidisi.upcolbpip.b2bcollaborations.impl.PublicBusinessInterfaceImpl#getProvidedInterface <em>Provided Interface</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PublicBusinessInterfaceImpl extends EObjectImpl implements PublicBusinessInterface {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The cached value of the '{@link #getRequiredInterface() <em>Required Interface</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRequiredInterface()
	 * @generated
	 * @ordered
	 */
	protected BusinessInterface requiredInterface;

	/**
	 * The cached value of the '{@link #getProvidedInterface() <em>Provided Interface</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProvidedInterface()
	 * @generated
	 * @ordered
	 */
	protected BusinessInterface providedInterface;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PublicBusinessInterfaceImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return B2bcollaborationsPackage.Literals.PUBLIC_BUSINESS_INTERFACE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BusinessInterface getRequiredInterface() {
		if (requiredInterface != null && requiredInterface.eIsProxy()) {
			InternalEObject oldRequiredInterface = (InternalEObject)requiredInterface;
			requiredInterface = (BusinessInterface)eResolveProxy(oldRequiredInterface);
			if (requiredInterface != oldRequiredInterface) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__REQUIRED_INTERFACE, oldRequiredInterface, requiredInterface));
			}
		}
		return requiredInterface;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BusinessInterface basicGetRequiredInterface() {
		return requiredInterface;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRequiredInterface(BusinessInterface newRequiredInterface) {
		BusinessInterface oldRequiredInterface = requiredInterface;
		requiredInterface = newRequiredInterface;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__REQUIRED_INTERFACE, oldRequiredInterface, requiredInterface));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BusinessInterface getProvidedInterface() {
		if (providedInterface != null && providedInterface.eIsProxy()) {
			InternalEObject oldProvidedInterface = (InternalEObject)providedInterface;
			providedInterface = (BusinessInterface)eResolveProxy(oldProvidedInterface);
			if (providedInterface != oldProvidedInterface) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__PROVIDED_INTERFACE, oldProvidedInterface, providedInterface));
			}
		}
		return providedInterface;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BusinessInterface basicGetProvidedInterface() {
		return providedInterface;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setProvidedInterface(BusinessInterface newProvidedInterface) {
		BusinessInterface oldProvidedInterface = providedInterface;
		providedInterface = newProvidedInterface;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__PROVIDED_INTERFACE, oldProvidedInterface, providedInterface));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__NAME:
				return getName();
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__REQUIRED_INTERFACE:
				if (resolve) return getRequiredInterface();
				return basicGetRequiredInterface();
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__PROVIDED_INTERFACE:
				if (resolve) return getProvidedInterface();
				return basicGetProvidedInterface();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__NAME:
				setName((String)newValue);
				return;
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__REQUIRED_INTERFACE:
				setRequiredInterface((BusinessInterface)newValue);
				return;
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__PROVIDED_INTERFACE:
				setProvidedInterface((BusinessInterface)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__NAME:
				setName(NAME_EDEFAULT);
				return;
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__REQUIRED_INTERFACE:
				setRequiredInterface((BusinessInterface)null);
				return;
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__PROVIDED_INTERFACE:
				setProvidedInterface((BusinessInterface)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__REQUIRED_INTERFACE:
				return requiredInterface != null;
			case B2bcollaborationsPackage.PUBLIC_BUSINESS_INTERFACE__PROVIDED_INTERFACE:
				return providedInterface != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(')');
		return result.toString();
	}

} //PublicBusinessInterfaceImpl
